package com.hsmpay.mobile.service.device.impl;

import com.hsmpay.common.service.impl.BaseServiceSupport;
import com.hsmpay.mobile.dao.device.DeviceKeyDao;
import com.hsmpay.mobile.pojo.device.DeviceKey;
import com.hsmpay.mobile.service.device.DeviceKeyService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Created by zhy on 16/1/6.
 */
@Service("deviceKeyService")
public class DeviceKeyServiceImpl<Entity extends DeviceKey, Query extends Object> extends BaseServiceSupport<Entity,Query> implements DeviceKeyService<Entity, Query> {
    @Resource(name = "deviceKeyDao")
    private DeviceKeyDao<DeviceKey,Long> deviceKeyDao;

    /**
     * 根据设备id获取设备秘钥对象
     * @return
     * @throws Exception
     */
    public DeviceKey getDeviceKeyByDeviceId(String deviceId) throws Exception {
        DeviceKey deviceKey = new DeviceKey();
        deviceKey.setDeviceId(deviceId);
        return deviceKeyDao.searchEntity(deviceKey);
    }
}
